package com.example.demoweb1.demos.web;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

//@Controller
@Controller
public class HelloController {
    @GetMapping("/hello")
    public String sayHello(){
        return "index";
    }
    @ResponseBody
    @GetMapping("/hi")
    public String sayHi(){
        return "hi";
    }
    @ResponseBody
    @RequestMapping("/user")
    public String test1(String username,String telephone){
        return username+"\n"+telephone;
    }

    @GetMapping("/test")
    public String test1(Model model){
        model.addAttribute("message","欢迎使用Thymeleaf！！！");
        return "test1";
    }
}
